package tp.pr4.listeners;

import java.util.ArrayList;

import tp.pr4.Direction;
import tp.pr4.Place;

public class NavigationModuleListenerArray extends ArrayList<NavigationModuleListener> implements NavigationModuleListener{
	private static final long serialVersionUID = 1L;


	@Override
	public void onMove(Place newPlace, Place oldPlace, Direction movingDirection) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onMove(newPlace, oldPlace, movingDirection);
	}

	@Override
	public void onSpaceShipReached() {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onSpaceShipReached();
	}

	@Override
	public void onRotationChanged(Direction newDirection) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onRotationChanged(newDirection);
	}

	@Override
	public void onCrash(Direction movingDirection, int type) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onCrash(movingDirection, type);
	}

	@Override
	public void onDoorToggled(Direction dir, boolean wasOpened, Place p) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onDoorToggled(dir, wasOpened, p);
	}

	
	
}
